package com.mall.util;

import java.util.Date;

import com.mall.controller.SeckillController;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class SeckillStart implements Runnable {
	private Integer id;
	private Date date;
	private Integer num;

	public SeckillStart(Integer id, Date date, Integer num) {
		super();
		this.id = id;
		this.date = date;
		this.num = num;
	}

	@Override
	public void run() {
		while (true) {
			try {
				Thread.sleep(50);
			} catch (InterruptedException e1) {
				e1.printStackTrace();
			}
			Date now = new Date();
			long time = date.getTime() - now.getTime();
			if (time <= 0) {
				SeckillController.commstart.put(id, 1);
				SeckillController.nummap.put(id, num);	
				break;
			}
		}
	}

}
